<template>
  <div>
    <van-swipe :autoplay="3000">
      <van-swipe-item v-for="(item, index) in bannerList" :key="index">
        <img v-lazy="item.imageUrl" width="100%" />
        <!-- <img :src="item.imageUrl" alt=""> -->
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
export default {
  data() {
    return {
      bannerList: [],
    };
  },

  created() {
    //  获取轮播图
    this.getBanner();
  },

  methods: {
    getBanner() {
      this.$http("banner")
        .then((res) => {
          console.log(res.data.banners);
          this.bannerList = res.data.banners;
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
</script>

<style scoped>
</style>